﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Observer
{
    public class SubjectHelper : IObserver
    {
        private ArrayList observers = new ArrayList();

        public void AddObserver(IObserver observer)
        {
            observers.Add(observer);
        }

        public void RemoveObserver(IObserver observer)
        {
            observers.Remove(observer);
        }

        public void Notify(object realSubject)
        {
            foreach (IObserver observer in observers)
            {
                observer.Notify(realSubject);
            }
        }
    }
}
